#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QFontDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    bool ok = false;
    QFont font = QFontDialog::getFont(&ok);
    QString debugText;

    debugText += "ok = " + QString(ok ? "true" : "false") + "\n";
    debugText += "Font family: " + font.family() + "\n";
    debugText += "Point size: " + QString::number(font.pointSize()) + "\n";
    debugText += "Bold: " + QString(font.bold() ? "true" : "false") + "\n";
    debugText += "Italic: " + QString(font.italic() ? "true" : "false");

    ui->label->setText(debugText);  // 将调试信息显示在 QLabel 中

    ui->pushButton->setFont(font);  // 设置按钮的字体
}
